# Maintainer: Antonio Rojas <arojas@archlinux.com>

_pyname=ypy
pkgname=python-y-py
pkgver=0.6.2
pkgrel=1
pkgdesc='Python bindings for the Y-CRDT built from yrs'
arch=(loong64 x86_64)
url='https://github.com/y-crdt/ypy'
license=(MIT)
depends=(gcc-libs
         glibc
         python)
makedepends=(python-build
             python-installer
             python-maturin)
checkdepends=(python-pytest)
source=(https://github.com/y-crdt/ypy/archive/v$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('87fddb8a5ff8e00e2d37440ce6556704aa4fb9bf9b4939f8656433871e3c01a1')

build() {
  cd $_pyname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_pyname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v
}

package() {
  cd $_pyname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
